<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>注册</title>
    <link rel="stylesheet" href="css/reset.css">
    <link rel="stylesheet" href="css/zhuce.css">
    <link rel="icon" type="x-con" href="https://www.midea.cn//favicon.ico">
</head>

<body>
    <div id="title">
        <div id="title-con">
            <img src="img/img1/logo@2x.png" alt="">
        </div>
    </div>
    <div id="center">
        <img src="img/img1/162747898112257.png" alt="">
        <div id="center-con">
            <h3>注册账号</h3>
            <input type="text" placeholder="输入手机号"><br>
            <p></p>
            <input type="text" placeholder="输入验证码" style="width: 270px;">
            <input type="button" value="获取验证码" style="width: 85px;text-indent: 0;color: skyblue;"><br>
            <p></p>
            <input type="password" placeholder="输入登录密码"><br>
            <p></p>
            <input type="password" placeholder="再次输入登录密码"><br>
            <p></p>

            <input type="checkbox" name="" id="btn">
            <span id="span">我已同意<a href="">《用户服务协议》</a>和<a href="">《隐私协议》</a></span><br>

            <input type="button" name="" value="注册" style="background-color: #0f7ece;color: white;"><br>
            <span></span>
            <span class="span">已有账号？<a href="denglu.html">立即登录</a></span>
            
        </div>
    </div>
    <div id="footer">

        <ul id="footer-con">
            <li><a href="">服务条款</a></li>
            <li><a href=""> 隐私政策</a></li>
            <li><a href=""> 联系我们</a></li>
            <li><a href=""> 投诉中心</a></li>
        </ul>
        <span>Copyright &copy  1968-2022 Midea Group. All Rights Reserved</span>
    </div>
</body>

</html>
<script src="js/jQuery.js"></script>
<script src="js/zhuce.js"></script>
<script>
   
   //注册（注册页面）  
  $("input").eq(6).click(function(){
       $.post("./goodsAndShoppingCart/addUser.php",{
           username:$("input").eq(0).val(),
          userpass:$("input").eq(3).val()},

           function (resText) {
              if(resText.trim()=="success"){
                alert("注册成功")  
                location.href="denglu.html"
              }
          
       })
    })

     //验证用户名是否存在(注册页面)
     $("input").eq(6).click(function(){
    $.get("./goodsAndShoppingCart/checkUser.php",{
        username:$("input").eq(0).val(),
        },
       function (resText) {
           if(resText.trim()=="0"){
           alert("用户名已存在，请重新注册")
           location.reload()
           }
      
    })
})
</script>